package pojo;
// Generated 16-giu-2013 19.52.47 by Hibernate Tools 3.2.1.GA


import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.UniqueConstraint;

/**
 * Film generated by hbm2java
 */
@Entity
@Table(name="film"
    ,catalog="mydb"
    , uniqueConstraints = @UniqueConstraint(columnNames="titolo") 
)
public class Film  implements java.io.Serializable {


     private Integer idfilm;
     private User user;
     private String titolo;
     private String genere;
     private String link;
     private String trama;
     private byte[] image;
     private String imdbUrl;
     private Boolean rented;
     private Set renteds = new HashSet(0);

    public Film() {
    }

	
    public Film(User user, String titolo) {
        this.user = user;
        this.titolo = titolo;
    }
    public Film(User user, String titolo, String genere, String link, String trama, byte[] image, String imdbUrl, Boolean rented, Set renteds) {
       this.user = user;
       this.titolo = titolo;
       this.genere = genere;
       this.link = link;
       this.trama = trama;
       this.image = image;
       this.imdbUrl = imdbUrl;
       this.rented = rented;
       this.renteds = renteds;
    }
   
     @Id @GeneratedValue(strategy=IDENTITY)
    
    @Column(name="idfilm", unique=true, nullable=false)
    public Integer getIdfilm() {
        return this.idfilm;
    }
    
    public void setIdfilm(Integer idfilm) {
        this.idfilm = idfilm;
    }
@ManyToOne(fetch=FetchType.LAZY)
    @JoinColumn(name="user_iduser", nullable=false)
    public User getUser() {
        return this.user;
    }
    
    public void setUser(User user) {
        this.user = user;
    }
    
    @Column(name="titolo", unique=true, nullable=false, length=45)
    public String getTitolo() {
        return this.titolo;
    }
    
    public void setTitolo(String titolo) {
        this.titolo = titolo;
    }
    
    @Column(name="genere", length=45)
    public String getGenere() {
        return this.genere;
    }
    
    public void setGenere(String genere) {
        this.genere = genere;
    }
    
    @Column(name="link", length=45)
    public String getLink() {
        return this.link;
    }
    
    public void setLink(String link) {
        this.link = link;
    }
    
    @Column(name="trama", length=95)
    public String getTrama() {
        return this.trama;
    }
    
    public void setTrama(String trama) {
        this.trama = trama;
    }
    
    @Column(name="image")
    public byte[] getImage() {
        return this.image;
    }
    
    public void setImage(byte[] image) {
        this.image = image;
    }
    
    @Column(name="imdb_url", length=45)
    public String getImdbUrl() {
        return this.imdbUrl;
    }
    
    public void setImdbUrl(String imdbUrl) {
        this.imdbUrl = imdbUrl;
    }
    
    @Column(name="rented")
    public Boolean getRented() {
        return this.rented;
    }
    
    public void setRented(Boolean rented) {
        this.rented = rented;
    }
@OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="film")
    public Set getRenteds() {
        return this.renteds;
    }
    
    public void setRenteds(Set renteds) {
        this.renteds = renteds;
    }




}


